(define (prime limit)
         (primes limit 3 '(2) '("<ul>"))
)

(define (primes limit n ps flist)
        (
         if (< n limit)
            (
             if (isPrime n ps)
                 (primes limit (+ n 2) (cons n ps) (cons "</li>" (cons n (cons "<li>" flist))))
                 (primes limit (+ n 2) ps flist)
            )
            (reverse (cons "</ul>" flist))
         )
)

(define (isPrime n pList)
        (if (null pList)
            #t
            (
             if (/= 0 (remainder n (head pList)))
                 (isPrime n (rest pList))
                 #f
             )
        )
)

(prime 50)
